import request from '@/utils/request'

// 获取信息
export function getInfo() {
  return request({
    url: '/device/plug',
    method: 'get',
  })
}

export function syncLock(lockId) {
  return request({
    url: `/device/plug/sync-lock/${lockId}`,
    method: 'post',
  })
}

export function getList(data) {
  return request({
    url: '/device/plug/list',
    method: 'get',
    params: data
  })
}

// 添加
export function add(data) {
  return request({
    url: '/device/plug',
    method: 'post',
    data: data
  })
}

// 编辑
export function edit(data) {
  return request({
    url: '/device/plug',
    method: 'put',
    data: data
  })
}

export function getSelect(data) {
  return request({
    url: '/device/plug/select',
    method: 'get',
    params: data
  })
}

export function associatedLockList(gatewayId) {
  return request({
    url: `/device/plug/associated-lock-list/${gatewayId}`,
    method: 'get'
  })
}

export default {
  getInfo,
  add,
  edit,
  getList,
  associatedLockList,
}